<template>
	<view>
		<cu-custom :isBack="true" bgColor="bg-blue">
			<block slot="content">卷取区域监控</block>
			<template slot="backText">
				<text class="cuIcon-back" @tap="beforePage"></text>
			</template>
		</cu-custom>
		<!-- 主题内容 -->
		<view  class="padding-t">
			<view class="public-main-info">
				<view class="u-main">
					<view class="u-main-title">
						<view>卷取区域监控</view>
						<view class="font-size22 flex" style="width: 200upx;">
							<view class="success"><text class="margin-left-10">正常</text></view>
							<view class="warn"><text class="margin-left-10">故障</text></view>
						</view>
					</view>
					<view class="u-main-line"></view>
					<view class="padding-tb-30 font-size22">
						<view class="juanTDC410">
							<view :class="['AIO0411', 'positionAbsolute', juanTDC410.AIO0411 == 1 ? 'text-blue' : 'text-red']">AIO04-11</view>
							<view :class="['AOS041', 'positionAbsolute', juanTDC410.AOS041 == 1 ? 'text-blue' : 'text-red']">AOS04-1</view>
							<view :class="['TDC410A', 'positionAbsolute', juanTDC410.TDC410A == 1 ? 'text-blue' : 'text-red']">TDC410-A</view>
							<view :class="['TDC4202B', 'positionAbsolute', juanTDC410.TDC4202B == 1 ? 'text-blue' : 'text-red']">TDC420-2B</view>
							<view :class="['AOS042', 'positionAbsolute', juanTDC410.AOS042 == 1 ? 'text-blue' : 'text-red']">AOS04-2</view>
							<view :class="['TDC420A', 'positionAbsolute', juanTDC410.TDC420A == 1 ? 'text-blue' : 'text-red']">TDC420-A</view>
							
							<view :class="['cenglengCU', 'positionAbsolute', juanTDC410.cenglengCU == 1 ? 'text-blue' : 'text-red']">层冷辊道CU</view>
							<view :class="['juanChuan1', 'positionAbsolute', juanTDC410.juanChuan1 == 1 ? 'text-blue' : 'text-red']">1#卷取传动</view>
							<view :class="['juanCU', 'positionAbsolute', juanTDC410.juanCU == 1 ? 'text-blue' : 'text-red']">卷取G6辊道CU</view>
							<view :class="['juanChuan2', 'positionAbsolute', juanTDC410.juanChuan2 == 1 ? 'text-blue' : 'text-red']">2#卷取传动</view>
							
						</view>
						<view class="juanPLC740">
							<view :class="['PLC740', 'positionAbsolute', juanPLC740.PLC740 == 1 ? 'text-blue' : 'text-red']">PLC740</view>
							<view :class="['AOC0741', 'positionAbsolute', juanPLC740.AOC0741 == 1 ? 'text-blue' : 'text-red']">AOC07-41</view>
							<view :class="['AOC0742', 'positionAbsolute', juanPLC740.AOC0742 == 1 ? 'text-blue' : 'text-red']">AOC07-42</view>
							<view :class="['AOC0744', 'positionAbsolute', juanPLC740.AOC0744 == 1 ? 'text-blue' : 'text-red']">AOC07-44</view>
							<view :class="['juanMcc', 'positionAbsolute', juanPLC740.juanMcc == 1 ? 'text-blue' : 'text-red']">441G07-MCC</view>
						</view>
						<view class="yunPLC510">
							<view :class="['PLC510', 'positionAbsolute', yunPLC510.PLC510 == 1 ? 'text-blue' : 'text-red']">PLC510</view>
							<view :class="['AI0512', 'positionAbsolute', yunPLC510.AI0512 == 1 ? 'text-blue' : 'text-red']">
								<view>AI05</view>
								<view>-12</view>
							</view>
							<view :class="['AIO0413', 'positionAbsolute', yunPLC510.AIO0413 == 1 ? 'text-blue' : 'text-red']">
								<view>AIO04</view>
								<view>-13</view>
							</view>
							<view :class="['AOSO58', 'positionAbsolute', yunPLC510.AOSO58 == 1 ? 'text-blue' : 'text-red']">
								<view>AOSO5</view>
								<view>-8</view>
							</view>
							<view :class="['AIO0511', 'positionAbsolute', yunPLC510.AIO0511 == 1 ? 'text-blue' : 'text-red']">
								<view>AIO05</view>
								<view>-11</view>
							</view>
							<view :class="['AIO0414', 'positionAbsolute', yunPLC510.AIO0414 == 1 ? 'text-blue' : 'text-red']">
								<view>AIO04</view>
								<view>-14</view>
							</view>
							<view :class="['AOS051', 'positionAbsolute', yunPLC510.AOS051 == 1 ? 'text-blue' : 'text-red']">
								<view>AOS05</view>
								<view>-1</view>
							</view>
						</view>
					</view>
					<view class="padding-tb-sm"></view>
				</view>
			</view>
		</view>
		<view class="cu-tabbar-height"></view>
	</view>
</template>

<script>
	import { post } from "@/lib/Util.js";
	export default {
		data() {
			return {
				juanTDC410: {
					AIO0411: null,
					AOS041: null,
					TDC410A: null,
					TDC4202B: null,
					AOS042: null,
					TDC420A: null,
					cenglengCU: null,
					juanChuan1: null,
					juanCU: null,
					juanChuan2: null
				},
				juanPLC740: {
					PLC740: null,
					AOC0741: null,
					AOC0742: null,
					AOC0744: null,
					juanMcc: null,
				},
				yunPLC510: {
					PLC510: null,
					AI0512: null,
					AIO0413: null,
					AOSO58: null,
					AIO0511: null,
					AIO0414: null,
					AOS051: null
				},
				timer: null
			}
		},
		created() {
			this.getInfo()
			this.getPLC740()
			this.getYunPLC()
		},
		mounted() {
			this.timer = setInterval(()=> {
				this.getInfo()
				this.getPLC740()
				this.getYunPLC()
			}, 10000)
		},
		beforeDestroy() {
			clearInterval(this.timer)
			this.timer = null
		},
		methods:{
			beforePage() {
				uni.navigateBack({
					delta: 1
				});
			},
			async getInfo() {
				let Fault_B0 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B0",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B1 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B1",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B4 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B4",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B5 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B5",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B6 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B6",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B9 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B9",
					      ts: "1"
					    }
					  ]
				})
				this.juanTDC410.AIO0411 = Fault_B0.data.tagList[0].value
				this.juanTDC410.AOS041 = Fault_B1.data.tagList[0].value
				this.juanTDC410.TDC410A = Fault_B4.data.tagList[0].value
				this.juanTDC410.TDC4202B = Fault_B5.data.tagList[0].value
				this.juanTDC410.AOS042 = Fault_B6.data.tagList[0].value
				this.juanTDC410.TDC420A = Fault_B9.data.tagList[0].value
				let Fault_B2 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B2",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B3 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B3",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B7 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B7",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B8 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "DC1_SCAN.Fault_B8",
					      ts: "1"
					    }
					  ]
				})
				this.juanTDC410.cenglengCU = Fault_B2.data.tagList[0].value
				this.juanTDC410.juanChuan1 = Fault_B3.data.tagList[0].value
				this.juanTDC410.juanCU = Fault_B7.data.tagList[0].value
				this.juanTDC410.juanChuan2 = Fault_B8.data.tagList[0].value
			},
			async getPLC740() {
				let Fault_B67 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B67",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B68 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B68",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B69 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B69",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B70 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B70",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B71 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B71",
					      ts: "2"
					    }
					  ]
				})
				this.juanPLC740.PLC740 = Fault_B67.data.tagList[0].value
				this.juanPLC740.AOC0741 = Fault_B68.data.tagList[0].value
				this.juanPLC740.AOC0742 = Fault_B69.data.tagList[0].value
				this.juanPLC740.AOC0744 = Fault_B70.data.tagList[0].value
				this.juanPLC740.juanMcc = Fault_B71.data.tagList[0].value
			},
			async getYunPLC() {
				let Fault_B0 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B0",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B1 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B1",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B2 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B2",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B3 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B3",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B4 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B4",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B5 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B5",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B6 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "WEIGHT.Fault_B6",
					      ts: "2"
					    }
					  ]
				})
				
				this.yunPLC510.PLC510 = Fault_B0.data.tagList[0].value
				this.yunPLC510.AI0512 = Fault_B1.data.tagList[0].value
				this.yunPLC510.AIO0413 = Fault_B2.data.tagList[0].value
				this.yunPLC510.AOSO58 = Fault_B3.data.tagList[0].value
				this.yunPLC510.AIO0511 = Fault_B4.data.tagList[0].value
				this.yunPLC510.AIO0414 = Fault_B5.data.tagList[0].value
				this.yunPLC510.AOS051 = Fault_B6.data.tagList[0].value
			}
		}
	}
</script>

<style>
	.juanTDC410 {
		background-image: url(../../../static/img/juanTDC410.png);
		background-size: 100% 100%;
		-moz-background-size: 100% 100%;
		background-position: 0px 30upx ;
		background-repeat: no-repeat;
		width: 100%;
		height: 338upx;
		position: relative;
	}
	.juanPLC740 {
		background-image: url(../../../static/img/juanPLC740.png);
		background-size: 100% 100%;
		-moz-background-size: 100% 100%;
		background-position: 0px 30upx ;
		background-repeat: no-repeat;
		width: 100%;
		height: 280upx;
		position: relative;
	}
	.yunPLC510 {
		background-image: url(../../../static/img/yunPLC510.png);
		background-size: 100% 80%;
		-moz-background-size: 100% 80%;
		background-position: 0px 30upx;
		background-repeat: no-repeat;
		width: 100%;
		height: 301upx;
		position: relative;
	}
	.AIO0411 {
		left: 20upx;
		top: 0upx;
	}
	.AOS041 {
		left: 140upx;
		top: 0upx;
	}
	.TDC410A {
		left: 260upx;
		top: 0upx;
	}
	.TDC4202B {
		left: 380upx;
		top: 0upx;
	}
	.AOS042 {
		left: 510upx;
		top: 0upx;
	}
	.TDC420A {
		left: 620upx;
		top: 0upx;
	}
	.cenglengCU {
		bottom: -30upx;
		left: 20upx;
	}
	.juanChuan1 {
		bottom: -30upx;
		left: 200upx;
	}
	.juanCU {
		bottom: -30upx;
		left: 400upx;
	}
	.juanChuan2 {
		bottom: -30upx;
		left: 600upx;
	}
	.PLC740 {
		bottom: -30upx;
		left: 20upx;
	}
	.AOC0741 {
		bottom: -30upx;
		left: 140upx;
	}
	.AOC0742 {
		bottom: -30upx;
		left: 270upx;
	}
	.AOC0744 {
		bottom: -30upx;
		left: 420upx;
	}
	.juanMcc {
		bottom: -30upx;
		left: 560upx;
	}
	.PLC510 {
		bottom: -10upx;
		left: 20upx;
	}
	.AI0512 {
		bottom: -30upx;
		left: 140upx;
	}
	.AIO0413 {
		bottom: -30upx;
		left: 240upx;
	}
	.AOSO58 {
		bottom: -30upx;
		left: 340upx;
	}
	.AIO0511 {
		bottom: -30upx;
		left: 450upx;
	}
	.AIO0414 {
		bottom: -30upx;
		left: 550upx;
	}
	.AOS051 {
		bottom: -30upx;
		left: 650upx;
	}
</style>

